﻿//10.	制造年份总量

var xData_4 = function() {
    var data = [1953, 1959, 1960, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018];
    return data;
}();
var ydata_4 = [4, 3, 6, 6, 3, 17, 19, 9, 62, 13, 13, 56, 103, 42, 60, 51, 48, 34, 52, 79, 111, 111, 92, 105, 134, 243, 409, 662, 445, 854, 781, 744, 748, 1273, 1397, 1533, 1668, 1767, 1411, 1414, 1584, 2127, 2445, 2742, 4525, 5718, 6951, 6486, 6461, 7068, 7858, 11716, 9778, 6273, 3701, 2445, 662, 596, 70, 9],
//最近七天
option4 = {
    // backgroundColor: "#344b58",
    "title": {
        "text": "制造日期趋势",
        "subtext": "",
        x: "4%",

        textStyle: {
            color: '#fff',
            fontSize: '22'
        },
        subtextStyle: {
            color: '#90979c',
            fontSize: '16',

        },
    },
    "tooltip": {
        "trigger": "axis",
        "axisPointer": {
            "type": "shadow",
            textStyle: {
                color: "#fff"
            },
        },
        // formatter: "危险名称：{b} <br/> 数量：{c}",
        formatter: function(params) {
            // console.log(params)
            var sum = 0;
            for(var x=0;x<ydata_4.length;x++){
                sum = sum + ydata_4[x]
            }
            return '制造年份：' + params[0].name + '<br/>' + '数量：' + params[0].data+ '<br>' + '占比：' + (params[0].data / sum * 100).toFixed(2) + '%，总数:'+sum;;
        }
    },
    "grid": {
        "borderWidth": 0,
        "top": 110,
        "bottom": 95,
        textStyle: {
            color: "#fff"
        }
    },
    "legend": {
        x: '4%',
        top: '5%',
        textStyle: {
            color: '#fff',
            fontSize: '16'
        },
        "data": ['检测报告数量']
    },


    "calculable": true,
    "xAxis": [{
        "type": "category",
        "axisLine": {
            lineStyle: {
                color: '#90979c'
            }
        },
        "splitLine": {
            "show": false
        },
        "axisTick": {
            "show": false
        },
        "splitArea": {
            "show": false
        },
        "axisLabel": {
            // "interval": 0,
            textStyle: {
                color: '#fff',
                fontSize: 16,
            },
        },
        "data": xData_4,
    }],
    "yAxis": [{
        "type": "value",
        "splitLine": {
            "show": false
        },
        "axisLine": {
            lineStyle: {
                color: '#90979c'
            }
        },
        "axisTick": {
            "show": false
        },
        "axisLabel": {
            // "interval": 0,
            textStyle: {
                color: '#fff',
                fontSize: 16,
            },
        },
        "splitArea": {
            "show": false
        },

    }],
    "dataZoom": [{
        "show": true,
        "height": 30,
        "xAxisIndex": [
            0
        ],
        bottom: 30,
        "start": 60,
        "end": 100,
        handleIcon: 'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',
        handleSize: '110%',
        handleStyle:{
            color:"#d3dee5",

        },
        textStyle:{
            color:"#fff"},
        borderColor:"#90979c"


    }, {
        "type": "inside",
        "show": true,
        "height": 15,
        "start": 1,
        "end": 35
    }],
    "series": [{
        "name": "检测报告数量",
        "type": "bar",
        "stack": "总量",
        "barMaxWidth": 35,
        "barGap": "10%",
        "itemStyle": {
            "normal": {
                "color": "#ff7638",
                "label": {
                    "show": true,
                    "textStyle": {
                        "color": "#fff"
                    },
                    "position": "top",
                    formatter: function(p) {
                        return p.value > 0 ? (p.value) : '';
                    }
                }
            }
        },
        "data":ydata_4
    },
    ]
}
